<template>
  <Content title="验收">
    <view class="quality-confirmation-box">
      <u-form
        labelPosition="left"
        :model="model"
        labelWidth="120"
        labelAlign="left"
        :rules="rules"
        ref="uForm"
      >
	  <u-form-item
	    label="验收结果"
	    prop="acceptType"
	    required
	  >
	    <u-radio-group
	      style="margin-top: 5px"
	      v-model="model.acceptType"
	      placement="row"
	    >
	      <u-radio label="试模NG" name="试模NG" style="margin-right: 20px"></u-radio>
	      <u-radio label="完成" name="完成"></u-radio>
	    </u-radio-group>
	  </u-form-item>
       <!-- <u-form-item
          label="服务态度评分："
          prop="serviceAttitudeRating"
          required
        >
          <uni-rate :max="5" v-model="model.serviceAttitudeRating" />
        </u-form-item>
        <u-form-item
          label="技术能力评分："
          prop="technicalAbilityRating"
          required
        >
          <uni-rate :max="5" v-model="model.technicalAbilityRating" />
        </u-form-item>
        <u-form-item label="响应速度评分：" prop="responseSpeedRating" required>
          <uni-rate :max="5" v-model="model.responseSpeedRating" />
        </u-form-item>

        <u-form-item label="评语：" prop="comment" required>
          <u-textarea v-model="model.comment" placeholder="请输入"></u-textarea>
        </u-form-item> -->
        <view class="btn-v">
          <view class="but-box">
            <u-button class="btn" @click="close" text="取消"></u-button>
            <u-button
              class="btn"
              type="primary"
              @click="submit"
              text="确定"
            ></u-button>
          </view>
        </view>
      </u-form>
    </view>
  </Content>
</template>

<script>
import Content from "@/components/content/index.vue";
import fetch from "@/utils/fetch";
export default {
  components: {
    Content,
  },
  data() {
    return {
      id: "",
      model: {
        // serviceAttitudeRating: "",
        // technicalAbilityRating: "",
        // responseSpeedRating: "",
        // comment: "",
        acceptType: "",
      },
      rules: {
        acceptType: {
          required: true,
          message: "请填写",
          trigger: "change",
        },
		// serviceAttitudeRating: {
        //   type: "number",
        //   required: true,
        //   message: "请填写",
        //   trigger: "change",
        // },
        // technicalAbilityRating: {
        //   type: "number",
        //   required: true,
        //   message: "请填写",
        //   trigger: "change",
        // },
        // responseSpeedRating: {
        //   type: "number",
        //   required: true,
        //   message: "请填写",
        //   trigger: "change",
        // },
        // comment: {
        //   required: true,
        //   message: "请填写",
        //   trigger: "change",
        // },
      },
    };
  },
  onLoad: function (option) {
    //option为object类型，会序列化上个页面传递的参数
    this.id = option.id;
  },
  onShow: function () {},
  mounted() {},
  methods: {
    close() {
      uni.navigateBack({
        delta: 1, //返回上一页
      });
    },
    submit() {
      const that = this;
      that.$refs.uForm.validate().then((valid) => {
        if (valid) {
          that.$loading.open();
          fetch("post", "/dms/moldMaintenanceHall/accept", {
            id: this.id,
            ...this.model,
          }).then((res) => {
            uni.$emit("openToast", {
              type: "success",
              title: "验收成功",
              complete() {
                uni.navigateBack({
                  delta: 1, //返回上一页
                });
              },
            });
          });
        }
      });
    },
  },
};
</script>

<style scoped lang="scss">
.quality-confirmation-box {
  padding: 40rpx;
  background-color: #fff;
  min-height: 100%;
}
</style>
